<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let currentURL = 'http://ppm-stage.allintechinc.com/h5_50000005/pages/Page50001883/Page50001883'
    let firstSlashIndex = currentURL.indexOf('/', 8);
    console.log(firstSlashIndex,'firstSlashIndex')
    if (firstSlashIndex !== -1) {
        prefix = currentURL.substring(0, firstSlashIndex);
        let protocols = ['http://', 'https://'];
        let protocol = protocols.find(p => prefix.includes(p));
  
        if (protocol) {
          let result = prefix.substring(protocol.length);
          result = result + '/app_50000005/';
          console.log(result, 'result');
          console.log(prefix,'prefix')
        //   let data = await post(`${prefix}/base/api/v1/product/url`, {
        //     url: result
        //   });
        //   if (data.status === 'success') {
        //     stateForm.tenantId = data.data.tenantId;
        //     stateForm.productId = data.data.id;
        //     console.log(stateForm.tenantId, 'stateForm.tenantId');
        //     getUser();
        //   } else {
        //     console.error('获取tenantId失败');
        //   }
        } else {
          console.error('未找到 `http://` 或 `https://`');
        }
      } else {
        console.error('无法提取前缀');
      }
    </script>
</body>
</html>